import React from 'react'
// Icon的二次封装，使Icon的name、color、size修改简易化
interface ClickType {
    (): void
}
interface PropType {
    name: string
    color?: string,
    size?: number,
    stop?: boolean,
    onClick?: ClickType
}
function Icon(props: PropType) {
    return (
        <i
            className={'iconfont icon-'+props.name}
            style={
                {
                    color: props.color,
                    fontSize: props.size
                }
            }
            onClick={
                (e) => {
                    props.stop && e.stopPropagation();
                    props.onClick();
                }
            }
        ></i>
    )
}
Icon.defaultProps = {
    color: '#333',
    size: 16,
    onClick: () => {

    },
    stop: false
}
export default Icon